import org.junit.Assert;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class NGuessNumberTest {

    @org.junit.jupiter.api.BeforeEach
    void setUp() {
    }

    @org.junit.jupiter.api.AfterEach
    void tearDown() {
    }
    @org.junit.jupiter.api.Test
    void generateAnswerTest(){
     int arr[] =  NGuessNumber.generateAnswer();
        Assert.assertEquals(4,NGuessNumber.generateAnswer().length);
        for (int i = 1 ; i <4 ; i ++){
            for (int j = 0 ; j < i ; j ++){
        Assert.assertEquals(true,arr[i]!=arr[j]);
            }
        }
        for (int i = 0 ; i < 4 ; i++){
            Assert.assertEquals(true,arr[i]<=9&&arr[i]>=0);
        }
    }

    @org.junit.jupiter.api.Test
    void getPlayerInputTest(){
      Assert.assertEquals(4,NGuessNumber.getPlayerInput(NGuessNumber.generateAnswer()).length);
    }
    @org.junit.jupiter.api.Test
    void compareGuessAnswerTest(){
        int a[] = {3,4,5,8};
        int b[] = {6,5,2,1};
        Assert.assertEquals(true,
                NGuessNumber.compareGuessAnswer(a,NGuessNumber.getPlayerInput(a)).contains("4A")||
                        NGuessNumber.compareGuessAnswer(b,NGuessNumber.getPlayerInput(a)).contains("0A1B")
        );
    }
    @org.junit.jupiter.api.Test
    void isWinTest(){
        int a[] ={5,4,3,2};
        int b[] ={5,4,3,2};
        Assert.assertEquals(true,NGuessNumber.isWin(NGuessNumber.compareGuessAnswer(a,b)));
    }
}